﻿
Namespace PL.MESSDK
    Public Class CertificateOfAnalysis_PL
	Inherits PLBase

		Public Sub New()
			MyBase.New()
		End Sub
	
		Public Sub New(ByVal queryName As String)
			MyBase.New(queryName)
		End Sub
	
		Sub OnRowUpdating(ByVal sender As Object, ByVal e As SqlRowUpdatingEventArgs) Handles MetaDataTable.OnRowUpdating
	
		End Sub

		Public Overrides Function Delete() As Boolean
		   'Throw New NotImplementedException("Delete To Come...")
		   Return False
		End Function

		Public Overrides Function Validate() As Boolean
		   'Throw New NotImplementedException("Validate To Come...")
		   Return True
        End Function

        Public Shared Sub GenerateCOAQuery(ByVal itemMasterRevID As Guid, ByVal societyID As Guid, ByVal lotID As Guid)
            Dim sqlcmd As System.Data.SqlClient.SqlCommand = Nothing

            Try
                sqlcmd = MetaQuery.GetSPCmdByMetaName("IMSRevision_GenerateCOAQuery")
                sqlcmd.Parameters("@ItemMasterRevID").Value = itemMasterRevID
                sqlcmd.Parameters("@LotID").Value = lotID

                'HACK 1: on hardcode un GUID par default pour l'instant. clieng 2012-08-14
                sqlcmd.Parameters("@SocietyID").Value = societyID


                sqlcmd.ExecuteNonQuery()

            Catch sqlex As System.Data.SqlClient.SqlException
                Throw sqlex
            Finally
                If sqlcmd IsNot Nothing Then
                    sqlcmd.Connection.Close()
                    sqlcmd.Dispose()
                End If
            End Try
        End Sub


	End Class
	End Namespace
